package com.dao.cook.imp;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import com.dao.cook.CmessageDaoY;
import com.po.MyMessage;

@Repository
public class CmessageDaoImpY implements CmessageDaoY {
	@Resource(name = "sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public int addMessage(MyMessage message) {
		int i=sqlSessionTemplate.insert("addMessageY", message);
		return i;
	}

	@Override
	public List<MyMessage> getAllMessageByParent(String message_parentid) {
		List<MyMessage> list=sqlSessionTemplate.selectList("getAllMessageByParentY", message_parentid);
		return list;
	}

	@Override
	public List<MyMessage> getAllMessage() {
		List<MyMessage> list=sqlSessionTemplate.selectList("getAllMessageY");
		return list;
	}

	@Override
	public List<MyMessage> getMessageByID(String userid) {
		List<MyMessage> list=sqlSessionTemplate.selectList("getMessageByIDY",userid);
		return list;
	}

	@Override
	public int delMessage(String message_id) {
		return sqlSessionTemplate.delete("delMessageY",message_id);
	}



	

}
